package com.elvin.platform.tcp;

import java.io.*;
import java.net.Socket;

public class TcpClient {
    public static void main(String[] args) throws IOException {
        Socket s = new Socket("172.28.151.128",9999);
       // Socket s = new Socket("81.68.121.222",9999);
        //Socket s = new Socket("ecmp.elviniot.net",9999);
        OutputStream os = s.getOutputStream();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));
        String line;
        while((line = br.readLine())!=null){
            if("886".equals(line)){
                break;
            }
            bw.write(line);
            bw.newLine();
            bw.flush();

            InputStream in = s.getInputStream();
            byte[] b=new byte[1024];
            int len=in.read(b);
            System.out.println(new String(b,0,len));
        }

        s.close();
    }
}